<link href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.0/css/bootstrap.min.css" rel="stylesheet" id="bootstrap-css">
<script src="//maxcdn.bootstrapcdn.com/bootstrap/3.3.0/js/bootstrap.min.js"></script>
<script src="//code.jquery.com/jquery-1.11.1.min.js"></script>
<!------ Include the above in your HEAD tag ---------->
<h1>3D FLIP BUTTON</h1>
<!-- flip-to-top or flip-to-bottom -->
<div class="cube flip-to-top">
<div class="default-state">
<span>Hover</span>
</div>
<div class="active-state">
<span>...and I flip</span>
</div>
</div>
<a href="#" id="flipto" data-face="bottom">Flip: to bottom</a>
$('#flipto').on("click", function(event) {
event.preventDefault();
var face = $(this).data("face");
if ( face == "bottom" ) {
$(".cube").removeClass("flip-to-top").addClass("flip-to-bottom");
$(this).data("face", "top").text("Flip: to top");
} else {
$(".cube").removeClass("flip-to-bottom").addClass("flip-to-top");
$(this).data("face", "bottom").text("Flip: to bottom");
}
});